import { rawRequestClient } from '#/api/request';

// 授权范围接口类型定义
export interface Scope {
  id?: string;
  name?: string;
  description?: string;
  createdAt?: string;
  createdBy?: string;
}

// 获取授权范围列表
export function getScopeList() {
  return rawRequestClient.get(`${import.meta.env.VITE_AUTH_SERVER}/scopes`);
}

// 创建授权范围
export function createScope(data: Omit<Scope, 'id' | 'createdAt' | 'createdBy'>) {
  return rawRequestClient.post(`${import.meta.env.VITE_AUTH_SERVER}/scopes`, data);
}

// 获取授权范围详情
export function getScopeDetail(id: string) {
  return rawRequestClient.get(`${import.meta.env.VITE_AUTH_SERVER}/scopes/${id}`);
}

// 更新授权范围
export function updateScope(id: string, data: Omit<Scope, 'id' | 'createdAt' | 'createdBy'>) {
  return rawRequestClient.put(`${import.meta.env.VITE_AUTH_SERVER}/scopes/${id}`, data);
}

// 删除授权范围
export function deleteScope(id: string) {
  return rawRequestClient.delete(`${import.meta.env.VITE_AUTH_SERVER}/scopes/${id}`);
}
